﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Easyleave.Logic.Domain;

namespace Easyleave.Workflow
{
	public class LocalDataExchangeService: ILocalDataExchangeService
	{


        #region ILocalDataExchangeService Members

        public void SubmitLeave(Guid leaveId, Guid? authorId, LeaveDto leave)
        {
            LeaveSubmittedEventArgs args = new LeaveSubmittedEventArgs(leaveId, authorId, leave);
            if (LeaveSubmitted != null)
            {
                LeaveSubmitted(null, args);
            }
        }

        public void RecommendLeave(Guid leaveId, Guid? authorId, string message)
        {
            LeaveMessageEventArgs args = new LeaveMessageEventArgs(leaveId, authorId, message );
            if (LeaveRecommended != null)
            {
                LeaveRecommended(null, args);
            }
        }

        public void ApproveLeave(Guid leaveId, Guid? authorId, string message)
        {
            LeaveMessageEventArgs args = new LeaveMessageEventArgs(leaveId, authorId, message);
            if (LeaveApproved != null)
            {
                LeaveApproved(null, args);
            }
        }

        public void RejectLeave(Guid leaveId, Guid? authorId, string message)
        {
            LeaveMessageEventArgs args = new LeaveMessageEventArgs(leaveId, authorId, message);
            if (LeaveRejected != null)
            {
                LeaveRejected(null, args);
            }
        }
        public event EventHandler<LeaveSubmittedEventArgs> LeaveSubmitted;

        public event EventHandler<LeaveMessageEventArgs> LeaveRecommended;

        public event EventHandler<LeaveMessageEventArgs> LeaveApproved;
        public event EventHandler<LeaveMessageEventArgs> LeaveRejected;

        #endregion
    }
}
